﻿<%@page import="java.net.URLDecoder"%>
<%@page import="com.hhit.collaborative_learning.utils.Utils"%>
<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String userNickName=Utils.getCookieValue("userNickName", request);
	request.setAttribute("userNickName", URLDecoder.decode(userNickName, "utf-8"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title></title>
<script src="<%=basePath%>js/jquery.js"></script>
<!-- Le styles -->
<link href="<%=basePath%>css/reset.css" rel="stylesheet">

<link href="<%=basePath%>css/custom.css" rel="stylesheet">
<link href="<%=basePath%>css/custom_colors.html" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
a {
	COLOR: #2f649a
}

a:link {
	text-decoration: none;
}

a:visited {
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

a:active {
	text-decoration: none;
}
</style>
<script type="text/javascript">
function logout(){
// 	alert(top.location.href);
	$.get("<%=basePath%>ClearSessionServlet",function(data,status){
		if(status=="success"){
			if(top.location.href.indexOf("myblog")>0){
				top.location.href="<%=basePath%>login.jsp?link="+encodeURIComponent("learning/myblog.jsp?page=bloglist");
			}else{
			    window.location="<%=basePath%>learning/learning.jsp";
			}
		}
	  });
}

function login(e,type){
	var href=top.location.href.substring(7).split("/");
	var link=encodeURIComponent(href[2]+"/"+href[3]);
	if(type==1){
		$(e).attr("href","<%=basePath %>login.jsp?link="+link);
	}else{
		$(e).attr("href","<%=basePath %>register.jsp?link="+link);
	}
}
</script>
</head>

<body>

	<div id="page_wrap">

		<header>

		<div class="logo-container">
			<c:choose>
				<c:when test="${cookie.userId.value ne null && cookie.userId.value ne ''}">
					<a id="logo" href="#">
						<table border="0">
							<tr valign="middle" align="center">
								<td valign="middle" align="center"><a href="<%=basePath %>my.jsp" target="_blank"><img
									style="width:50px;height:50px;border-radius:50%"
									src="<%=basePath%>userIcons/${cookie.userIcon.value}" /></a></td>
								<td width="20px"></td>
								<td valign="middle" align="center"
									style="text-align:center; vertical-align:middle; color:#000">
									${requestScope.userNickName}</td>
							</tr>
						</table>
					</a>
					<p align="right"
						style="text-align:right; padding-bottom:10px; padding-right:10px; font-size: 12px">
						<a href="#" onclick="logout()">退出登录 </a>
					</p>
				</c:when>
				<c:otherwise>
					<p align="center"
						style="text-align:center; margin-bottom:30px;margin-top:30px; font-size: 12px">
						<a onclick="login(this,1)" href="#" target="_top">登录 </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="login(this,2)" href="#" target="_top">注册 </a>
					</p>
				</c:otherwise>
			</c:choose>
		</div>
		<!-- Logo Side ENDS --> <nav>

		<ul id="menu">
			<li>
				<div class="menu-abs-bg background-color"></div>
				<div class="home-icon menu-specs">
					<a href="../home.jsp" target="_parent">首页</a>
					<!--<span>Lorem Ipsum Dolor Sit Amet</span>-->
				</div>
			</li>
			<li style="background-color: #0AA!important;">
				<div class="menu-abs-bg background-color"></div>
				<div class="aboutus-icon menu-specs">
					<a href="learning.jsp" target="_parent">专题学习</a>
					<!--<span>Praesent volutpat turpis</span>-->
				</div>
			</li>
			<li>
				<div class="menu-abs-bg background-color"></div>
				<div class="bbs-icon menu-specs">
					<a href="learning.jsp" target="_parent">BBS论坛</a>
					<!--<span>Praesent volutpat turpis</span>-->
				</div>
			</li>
			<li>
				<div class="menu-abs-bg background-color"></div>
				<div class="services-icon menu-specs">
					<a href="../community/community.jsp" target="_parent">协作社区</a>
					<!--<span>Morbi tincidunt justo sed</span>-->
				</div>
			</li>
			<li>
				<div class="menu-abs-bg background-color"></div>
				<div class="portfolio-icon menu-specs">
					<a href="../questions/questions.jsp" target="_parent">提问</a>
					<!--<span>Aliquam pharetra rutrum</span>-->
				</div>
			</li>
			<li>
				<div class="menu-abs-bg background-color"></div>
				<div class="blog-icon menu-specs">
					<a href="../download/download.jsp" target="_parent">资料下载</a>
					<!--<span>Vivamus sagittis nibh</span>-->
				</div>
			</li>
<!-- 			<li> -->
<!-- 				<div class="menu-abs-bg background-color"></div> -->
<!-- 				<div class="contact-icon menu-specs"> -->
<!-- 					<a href="../management/management.jsp" target="_parent">系统设置</a> -->
					<!--<span>Quisque sed felis eu turpis</span>-->
<!-- 				</div> -->
<!-- 			</li> -->
		</ul>
		<!-- Menu ENDS --> </nav><!-- Nav ENDS --> </header>
		<!-- Left Side ENDS -->

	</div>
	<!-- Page Wrap ENDS -->

	<script src="<%=basePath%>js/custom.js"></script>
</body>
</html>
